#ifndef __RTC__
#define __RTC__

#include "main.h"

#define RTC_USART_BUFF_LENTH      19

typedef struct
{
	
	RTC_DateTypeDef Alarm_Date;
	
	RTC_TimeTypeDef Alarm_Time;
	
}   RTC_USER_AlarmTypeDef;

typedef struct
{
	RTC_DateTypeDef Get_Date;
	
	RTC_TimeTypeDef Get_Time;
	
}   RTC_GET_DateTime_TypeDef;

extern uint8_t USART_SET_RTC_TIME_Flag;
extern uint8_t UART_RX_BUFF[RTC_USART_BUFF_LENTH];
extern RTC_GET_DateTime_TypeDef Get_Date_Time;
extern RTC_USER_AlarmTypeDef sAlarm;

void RTC_Set_DateTimeCounter(RTC_DateTypeDef *sDate, RTC_TimeTypeDef *sTime);
void RTC_Get_DateTimeCounter(RTC_DateTypeDef *sDate, RTC_TimeTypeDef *sTime);
void RTC_Set_AlarmCounter_IT(RTC_DateTypeDef *sDate, RTC_TimeTypeDef *sTime);
void RTC_Get_AlarmCounter(RTC_DateTypeDef *sDate, RTC_TimeTypeDef *sTime);
uint32_t GetDiffDate(RTC_DateTypeDef StartDate, RTC_DateTypeDef EndDate);
RTC_DateTypeDef CalculateDate(RTC_DateTypeDef FromDate, uint32_t DayDiff);
uint8_t GetDayOfMonth(uint8_t year, uint8_t month);
uint8_t RTC_USER_WeekDayNum(uint32_t nYear, uint8_t nMonth, uint8_t nDay);
void USART_SET_RTC_TIME(void);



#endif
